﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Secondhand_Book_Trade
{
    public partial class AdminDashboard : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("Login.aspx");
                return;
            }
            lblUsername.Text = Session["Username"].ToString();
            lblNickname.Text = Session["Nickname"].ToString();
            lblRole.Text = GetRoleName(Session["Role"].ToString());
            imgAvatar.ImageUrl = Session["AvatarUrl"]?.ToString() ?? "default.png";
            lblEmail.Text = Session["Email"].ToString();
            lblPhone.Text = Session["Phone"].ToString();
        }
        private string GetRoleName(string role)
        {
            switch (role)
            {
                case "0": return "普通用户";
                case "1": return "卖家";
                case "2": return "管理员";
                default: return "未知";
            }
        }
    }
}